﻿using System;
using System.Web.Mvc;
using DataAccess.Entities;

public static class UrlHelperExtensions
{
    #region Basic

    public static String Root(this UrlHelper helper, Boolean absolute)
    {
        String rootUrl = null;

        if (absolute)
        {
            if (helper.RequestContext.HttpContext.Request.Url != null)
            {
                String scheme = helper.RequestContext.HttpContext.Request.Url.Scheme;
                String host = helper.RequestContext.HttpContext.Request.Url.Host;
                Int32 port = helper.RequestContext.HttpContext.Request.Url.Port;
                rootUrl = new UriBuilder(scheme, host, port).ToString();
            }
        }
        else
        {
            rootUrl = "/";
        }

        return rootUrl;
    }

    #endregion Basic

    #region Regristration

    public static String RegistrationConfirmation(this UrlHelper helper, String confirmationCode)
    {
        return helper.RouteUrl("RegistrationConfirmation", new { confirmationCode = confirmationCode });
    }

    public static String CompleteRegistration(this UrlHelper helper, int profileId)
    {
        return helper.RouteUrl("CompleteRegistration", new { profileId = profileId });
    }

    #endregion Registration

    #region Reset Password

    public static String ResetPasswordConfirmation(this UrlHelper helper, String confirmationCode)
    {
        return helper.RouteUrl("ResetPasswordBegin", new { confirmationCode = confirmationCode });
    }

    #endregion Reset Password

    #region Home

    public static string Home(this UrlHelper helper)
    {
        return helper.RouteUrl("Home");
    }

    #endregion Home

    #region Profile

    public static String Profile(this UrlHelper helper, int profileId)
    {
        return helper.RouteUrl("My Profile", new { profileId = profileId });
    }

    public static String EditProfile(this UrlHelper helper, int profileId)
    {
        return helper.RouteUrl("Edit Profile", new { profileId = profileId });
    }

    #endregion Profile

    #region Discussion

    public static string Discussions(this UrlHelper helper)
    {
        return helper.RouteUrl("Discussions");
    }

    #endregion Discussion

    #region Events

    public static string Events(this UrlHelper helper)
    {
        return helper.RouteUrl("Events");
    }

    #endregion Events

    #region Interests

    #endregion Interests

    #region Images

    public static string Friends(this UrlHelper helper)
    {
        return helper.RouteUrl("/Content/images/freinds_icon.png");
    }

    public static string Messages(this UrlHelper helper)
    {
        return helper.RouteUrl("/Content/images/message_icon.png");
    }

    public static string ProfilePhoto(this UrlHelper helper)
    {
        return helper.RouteUrl("/Content/images/profile-photo.png");
    }

    #endregion Images
}